//
//  FAQTableVC.m
//  DaoZiJinFu
//
//  Created by woker on 16/6/28.
//  Copyright © 2016年 iwoker. All rights reserved.
//

#import "FAQTableVC.h"
#import "FAQCell.h"
#import "FAQDetail.h"

@interface FAQTableVC ()<UIWebViewDelegate> {
    UIWebView *_webView;
    NSString *_urlString;
}

@end

@implementation FAQTableVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = BACKGROUND_COLOR;
    [self leftButton:nil];
    [self setupTitleView:@"常见问题"];
    _urlString = @"http://ludaojinfu.com/appstatichtml/common.html";
    _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    _webView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_webView];
    _webView.delegate = self;
    [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_urlString]]];
    JSVIEWSHOW;
}

- (void)leftBarItemOnClick:(id)sender {
    NSLog(@"%@",_webView.request.URL);
    NSString *url = [NSString stringWithFormat:@"%@",_webView.request.URL];
    if ([url isEqualToString:_urlString]) {
        [self.navigationController popViewControllerAnimated:YES];
    }else {
        [_webView goBack];
    }
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
    JSVIEWHIDE;
    JSSHOW(LOAD_FAIL_TIP);
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    JSVIEWHIDE;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

@end
